package annotation.test2;

import java.net.CacheRequest;
import java.util.Map;
//串讲步骤5:启动包的扫描, 启动@Bean扫描 并 创建 有@Bean注解的对象
/**
 * @author 甘赵辉
 * @date 2023/2/28
 */
public class Main {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        Class[] aClass1 = ClassUtils.getClassByPackage("annotation.test2");
        Object[] objects = ClassUtils.scanClassHasBean(aClass1);//throws 异常
        for (Object o : objects){
            if(o instanceof  Dog){
                Dog dog = (Dog)o;
                dog.eat();
            }
            if(o instanceof Fish){
                Fish fish = (Fish) o;
                fish.eat();
            }
        }


    }
}
